#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n;
    cin >> n;
    string s1, s2;
    cin >> s1 >> s2;
    map<char, int> mp1;
    for (auto &ch : s1)
    {
        mp1[ch] ++;
    }
    bool flag = true;
    for (auto &ch : s2)
    {
        if (mp1[ch] == 0)
        {
            flag = false;
            break;
        }
        else mp1[ch] --;
    }
    if (flag)
    {
        cout << "YES\n";
    }
    else
    {
        cout << "NO\n";
    }
}
signed main()
{
    int q = 1;
    cin >> q;

    while (q--)
    {
        solve();
    }
}
